<?php
class SiteAction extends IntesysAction {
	function index(){ 
		$integral_typeDB=D('Integral_type');
		$this->list_inteType=$integral_typeDB->where(['site_id'=>__SITEID__])->select();
		$this->info=$this->dao->where(['id'=>__SITEID__])->find();
		$this->nowNum=M('Member')->where(['site_id'=>__SITEID__])->count('id');
	    $this->display();   
	}
	//序列化联系人，电话，地址，行业等字段为config ，提交名称，微信登录	
	function update(){
		if(IS_POST){
			$config=[];
			$config['contact']=$this->_param('contact');
			$config['phone']=$this->_param('phone');
			$config['industry']=$this->_param('industry');
			$config['address']=$this->_param('address');
			
			//$_POST['id']=__SITEID__;
			$data['id']=__SITEID__;
			$data['config']=serialize($config);
			$data['title']=$this->_param('title');
			$data['is_wxLogin']=$this->_param('is_wxLogin');
			$data[C('TOKEN_NAME')]=$this->_param(C('TOKEN_NAME'));
			$ret=$this->dao->data($data)->save();
			if($ret>=0){
				$this->success('保存成功');	
			}else{
				$this->error('保存失败，请重试！');	
			}
			//parent::update($data);
		}
		
	}
}

